import { formConfig } from "./../../../config/formConfig";

export const FormConfig = formConfig({
  formItems: [
    {
      label: "表单1",
      type: "number",
      otherOptions: {
        placeholder: "请输入账号",
      },
      prop: "account",
      rules: [
        {
          required: true,
          message: "请输入账号",
          trigger: "change",
        },
        {
          validator: (rule, value, callback) => {
            console.log("....", typeof value);
            if (value.length < 3 && value.length > 1) {
              callback(new Error("请输入长度大于3"));
            }
          },
          trigger: "change",
        },
      ],
    },
    {
      label: "表单2",
      type: "password",
      prop: "password",
      otherOptions: {
        placeholder: "请输入密码",
      },
      rules: [{ required: true, message: "请输入密码" }],
    },
    {
      label: "表单3",
      type: "datepicker",
      otherOptions: {
        startPlaceholder: "开始时间",
        endPlaceholder: "结束时间",
        type: "daterange",
        "unlink-panels": true,
        // disabled: true,
      },
      prop: "date",
      rules: [{ required: true, message: "请选择日期" }],
    },

    {
      label: "表单4",
      type: "select",
      otherOptions: {
        placeholder: "请选择部门",
        clearable: true,
        multiple: true,
      },
      prop: "dep",
      valueEnum: [
        {
          key: 1,
          value: "部门1",
        },
        {
          key: 2,
          value: "部门2",
        },
        {
          key: 3,
          value: "部门3",
        },
        {
          key: 4,
          value: "部门4",
        },
      ],
      rules: [{ required: true, message: "请选择", trigger: "blur" }],
      width: 100,
    },
  ],
  labelWidth: "100px",
  //   itemColLayout: {
  //     // span: 8,
  //   },
  //   itemStyle: {
  //     padding: "",
  //   },
});
